<html>
<head><meta charset="utf-8"><title>what should i actually use to rebase onto upstream? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html">what should i actually use to rebase onto upstream?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223310747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223310747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gus Wynn <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223310747">(Jan 19 2021 at 23:19)</a>:</h4>
<p>when rebasing my branches (including local master) onto upstream, i usually do:<br>
git fetch upstream/master<br>
git reset --hard upstream/master (when on local master)<br>
or I do<br>
git rebase upstream/master when on another branch<br>
recently I also learned that <br>
git switch -C master upstream/master does the same thing as the reset (i think?)</p>
<p>also, the dev guide says to do git pull upstream/master, which seems to git fetch then git MERGE<br>
does this often correctly fast-forward so its like the rebase? or am i misunderstanding git?</p>
<p>and which one should I use? I am thinking that we should probably recommend git pull --rebase (is that what others use), and then also have the guide mention "git rebase upstream/master" for when you want to rebase other branches (i think git pull only does the current branch)</p>



<a name="223310969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223310969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223310969">(Jan 19 2021 at 23:22)</a>:</h4>
<p>the difference between <code>pull</code> and <code>pull --rebase</code> only matters when you've made commits to your master branch instead of a feature branch</p>



<a name="223311015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223311015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223311015">(Jan 19 2021 at 23:22)</a>:</h4>
<p>which I think we should not recommend</p>



<a name="223311279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223311279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223311279">(Jan 19 2021 at 23:25)</a>:</h4>
<p>FWIW, I have these two aliases:</p>
<div class="codehilite"><pre><span></span><code>[alias]
    purr = pull --rebase=true --autostash -Xignore-space-change --no-stat
    prum = purr upstream master
</code></pre></div>
<p>and thus just do <code>git prum</code> in my PR branches when needed.</p>



<a name="223383259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223383259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gus Wynn <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223383259">(Jan 20 2021 at 14:58)</a>:</h4>
<p><span class="user-mention" data-user-id="125270">@scottmcm</span> ah those are nice! Thanks!<br>
<span class="user-mention" data-user-id="232545">@Joshua Nelson</span> so merge will correctly fast forward in master if I don't mess with it (I don't). For feature branches, this is also true, if you haven't messed with master?</p>



<a name="223383718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223383718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gus Wynn <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223383718">(Jan 20 2021 at 15:00)</a>:</h4>
<p>I find git <em>extremely confusing</em>, even for experienced devs, I think it would be nice if we explained this in the guide, as well as give a suggestion for what to do to rebase other feature branches after your git pull'd on one (update your local master to upstream with a reset --hard and got rebase the other branches onto it, and git push --force them)</p>



<a name="223384226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223384226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gus Wynn <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223384226">(Jan 20 2021 at 15:02)</a>:</h4>
<p>Coming from working primarily with mecurial, it would be great to have these recommendations right there in the guide, as googling and stack overflow give many different answers</p>



<a name="223384813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223384813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223384813">(Jan 20 2021 at 15:04)</a>:</h4>
<p><span class="user-mention" data-user-id="257428">@Gus Wynn</span> does <a href="https://rustc-dev-guide.rust-lang.org/git.html">https://rustc-dev-guide.rust-lang.org/git.html</a> answer some of your questions?</p>



<a name="223385131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223385131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223385131">(Jan 20 2021 at 15:06)</a>:</h4>
<p>And how can we make that page easier to find?</p>



<a name="223386611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223386611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gus Wynn <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223386611">(Jan 20 2021 at 15:15)</a>:</h4>
<p>Ah the rebase section and no-merge policy section are good <br>
. I'll try to look closer today and add any info I think is missing. From a glance I think it's just resetting local master to upstream/master (if you git pull in a feature branch, do you have to do this?)</p>



<a name="223387206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223387206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223387206">(Jan 20 2021 at 15:19)</a>:</h4>
<p>git pull in a feature branch doesn't really do anything</p>



<a name="223387255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223387255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223387255">(Jan 20 2021 at 15:20)</a>:</h4>
<p>unless you have multiple people working on the same branch, which is hard to manage and I don't usually recommend</p>



<a name="223387730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223387730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gus Wynn <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223387730">(Jan 20 2021 at 15:23)</a>:</h4>
<p>Oh so git pull upstream master merge (with ff) local master, that was what was confuseing to me. I think I can make a few things more clear in the git page, hopefullyill have a or today</p>



<a name="223397076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223397076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gus Wynn <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223397076">(Jan 20 2021 at 16:23)</a>:</h4>
<p><a href="https://github.com/rust-lang/rustc-dev-guide/pull/1031">https://github.com/rust-lang/rustc-dev-guide/pull/1031</a> probably needs some close eyes but this is what I was thinking (now I have to go to work lolol)</p>



<a name="223397179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223397179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223397179">(Jan 20 2021 at 16:24)</a>:</h4>
<p>thank you! I'll take a look</p>



<a name="223447113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/what%20should%20i%20actually%20use%20to%20rebase%20onto%20upstream%3F/near/223447113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F.html#223447113">(Jan 20 2021 at 22:37)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/what.20should.20i.20actually.20use.20to.20rebase.20onto.20upstream.3F/near/223311279">said</a>:</p>
<blockquote>
<p>FWIW, I have these two aliases:</p>
<div class="codehilite"><pre><span></span><code>[alias]
    purr = pull --rebase=true --autostash -Xignore-space-change --no-stat
    prum = purr upstream master
</code></pre></div>
<p>and thus just do <code>git prum</code> in my PR branches when needed.</p>
</blockquote>
<p>I use the fish shell, which has the notion of 'abbreviations', so I've found it useful to use <code>gup='git pull upstream'</code> so that <code>gup master</code> expands to <code>git pull upstream master</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>